package com.yingside.collection;

import java.util.Arrays;

public class ArrayCopy {
    public static void main(String[] args) {
//          int [] nums = {1,3,5,7};
//        int[] newNums = Arrays.copyOf(nums, nums.length+1);
//
//        System.out.println(Arrays.toString(newNums));

        int [] nums = {1,3,5,7};
        nums = Arrays.copyOf(nums,nums.length+1);
        System.arraycopy(nums,1,nums,2,3);
        nums[1] = 2;

        System.out.println(Arrays.toString(nums));
    }
}
